<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use App\Helpers\Common;
use Request,Plupload;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests,Common;
    

    public function plupload(Request $requet)
	{
	    if($request->file) {
	    	$rs['status'] = false;
	    	$file = $request->pic;
			$extname = $file->getClientOriginalExtension();
			$filename = date('YmdHis').rand(100,999).'.'.$extname;
			$path = '/uploads/'.date('Ymd').'/';
			$flag = $file->move(public_path().$path, $filename);
			if($flag) {
			  $rs['status'] = true;
			  $rs['data'] = $path.$filename;
			  return $rs;
			}
			return $rs;	
	    }
			       
			        
			    
	    return response()->json($rs['result']);
	}

    

   
}
